package batch.home;

import javax.xml.parsers.*;

import org.xml.sax.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import java.util.Date;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.*;

import java.util.Vector;
import java.util.Properties;
import java.io.*;
import java.net.*;

import java.sql.*;
import java.io.*;
import java.net.URL;
import batch.common.db.ConnectionManager;



import batch.common.report.*;

public class makeCpHtmlPol
{
    final String strJavaName = "CP Html Poland";
    final int    ILENG       = 10;

    private final String TODAY              = DateFormatUtils.format(new Date(), "yyyyMMdd");  //Get Current Date
    private final String MAILSUBJECT        = "POL CP Html Batch Error(" + TODAY + ")";
    private final String FILE_PATH          = "/home02/nas/pol_pub/sm3/batch/html/";
    private final String ROOT_URL    = "http://pl.samsungmobile.com";

    String strContentName = "";
    String strPreviewUrl = "";
    String strContentID = "";
    String strUrl = "";
    
    String content_id = "";
    String content_name = "";
    String preview_url = "";
    String order_url = "";
    String content_link = "";
    String content_price = "";
    String content_price2 = "";
    String more_link = "";
   
    String Phone_model = "";    
    String CP_URL = "http://funclub.pl.samsungmobile.com/funclub/xml/GetAllContentList.jsf?NUM=10";
    
    private StringBuffer sHtml = new StringBuffer();

    public makeCpHtmlPol(){
    	Homeinit();
    }
    public void Homeinit(){
        BufferedReader bfrString = null;
        StringBuffer sbfXml = new StringBuffer();

        Document doc = null;
        NodeList nlTemp = null;
    	
        OutputStreamWriter fw = null;
        
        try{
				URLConnection urlCon = new URL("http://funclub.pl.samsungmobile.com/funclub/xml/GetAllContentList.jsf?NUM=10").openConnection();
	            bfrString = new BufferedReader(new InputStreamReader(urlCon.getInputStream(), "ISO-8859-1"));
	
	            String line = "";
	            Vector vtElem        = new Vector();
	            Vector vGames        = new Vector();
	            Vector vRingtone     = new Vector();
	            Vector vWallpapers   = new Vector();
	            Vector vScreensavers = new Vector();	            
	            Vector vTmpMore		 = new Vector();

	            while ((line = bfrString.readLine()) != null)
	            {
	                sbfXml.append(line);
	            }

	            byte bxml[] = sbfXml.toString().getBytes("ISO-8859-1");
	            ByteArrayInputStream is = new ByteArrayInputStream(bxml);

	            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
	            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
	            doc = docBuilder.parse(new InputSource(is));
	            Element elem = doc.getDocumentElement();
	            elem.normalize();

	            nlTemp = elem.getChildNodes();
	            
	                for(int x=0;x<nlTemp.getLength();x++){
	                    if(nlTemp.item(x).getChildNodes().getLength() > 0){
	                        vtElem.addElement(nlTemp.item(x).getChildNodes());
	                    }
	                }
	                
	                for(int x=0;x<vtElem.size();x++){
	                    Element tmpElem = (Element)vtElem.elementAt(x);
	                    String strElem = tmpElem.getTagName();

	                    for (int i = 0; i < ILENG; i++) {
	                        Properties pptNode = new Properties();
	                        
	                        nlTemp = tmpElem.getElementsByTagName("CONTENT_ID");
	                        pptNode.setProperty("CONTENT_ID", nlTemp.item(i).getFirstChild().getNodeValue());
	                        nlTemp = tmpElem.getElementsByTagName("CONTENT_NAME");
	                        pptNode.setProperty("CONTENT_NAME", nlTemp.item(i).getFirstChild().getNodeValue());
	                        nlTemp = tmpElem.getElementsByTagName("PREVIEW_URL");
	                        pptNode.setProperty("PREVIEW_URL", nlTemp.item(i).getFirstChild().getNodeValue());
	                        nlTemp = tmpElem.getElementsByTagName("ORDER_URL");
	                        pptNode.setProperty("ORDER_URL", nlTemp.item(i).getFirstChild().getNodeValue());
	                        nlTemp = tmpElem.getElementsByTagName("CONTNT_PRICE");
	                        pptNode.setProperty("CONTNT_PRICE", nlTemp.item(i).getFirstChild().getNodeValue());	                        
	                        nlTemp = tmpElem.getElementsByTagName("CONTNT_PRICE2");
	                        pptNode.setProperty("CONTNT_PRICE2", nlTemp.item(i).getFirstChild().getNodeValue());	                        
	                        
	                        if(strElem.equals("RINGTONES")){
	                            vRingtone.addElement(pptNode);
	                        }	                        
	                        if(strElem.equals("WALLPAPERS")){
	                        	vWallpapers.addElement(pptNode);
	                        }
	                        if(strElem.equals("SCREENSAVERS")){
	                            vScreensavers.addElement(pptNode);
	                        }
	                        if(strElem.equals("GAMES")){
	                            vGames.addElement(pptNode);
	                        }	                        
	                  }
	                }
	
	            File fl = new File(FILE_PATH);
	
	            if(!fl.isDirectory()){
	                fl.mkdirs();
	            }
	
	            if(vRingtone.size() > 0){
	            	getRealToneHomeMain(vRingtone,vTmpMore);
	            	getRealToneRight(vRingtone,vTmpMore);
	            	getRealToneMember(vRingtone,vTmpMore);
	            }
	            if(vWallpapers.size() > 0){
	            	getWallpaper(vWallpapers,vTmpMore);
	            	getWallpaperMember(vWallpapers,vTmpMore);
	            }
	            if(vScreensavers.size() > 0){
	            	getScreensaverRight(vScreensavers,vTmpMore);
	            }
	            if(vGames.size() > 0){
	            	getGameHomeMain(vGames,vTmpMore);
	            	getGameRight(vGames,vTmpMore);	            	
	            }
	            
	            
        }catch(Exception ex){
            ex.printStackTrace();
            //Logger.getLogger("home.tur_home").info(ex.toString());
            ReportError.byEmail(MAILSUBJECT, ex.toString());
        }finally {
            if(bfrString != null) try { bfrString.close(); } catch (Exception e) {}
        }
    }
    
    
    

    public void getGameHomeMain(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /* Front MAIN Page Game*/
            sHtml.setLength(0);

            if(pVector.size() > 0) {
            	for(int i=0; i<5; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);

	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");	                

	                if(content_name.length() >= 13){
	                	content_name = content_name.substring(0, 13) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");	                
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");	                

	                sHtml.append("<li>\n")
			                .append("	<div class=\"imgBox77\"><a href=\""+order_url+"\"><img src=\""+preview_url+"\" alt=\""+content_name+"-Gry\" width=\"77\" height=\"77\"></a></div>\n")
			                .append("	<p class=\"p_tit\">\n")
			                .append(content_name)
			                .append("	<div class=\"p_btnA\">\n")
			                .append("		<a href=\""+order_url+"\"><img src=\""+ROOT_URL+"/image/common/btn_detail.gif\" alt=\"DetailSzczegoły\"></a>\n")
			                .append("		<a href=\""+order_url+"\"><img src=\""+ROOT_URL+"/image/common/btn_buy.gif\" alt=\"Kup\"></a>\n")
			                .append("	</div>\n")
			                .append("</li>\n");	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/homegame_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    

    public void getGameRight(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;
        
        try{
            /* Front MAIN Page Game*/
            sHtml.setLength(0);

            if(pVector.size() > 0) {
            	for(int i=0; i<2; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);

	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");	                

	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");	                
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");	                

	                sHtml.append("<div class=\"prdInfo mb5\">\n")
		                .append("	<div class=\"imgBox50\">\n")
		                .append("	<a href=\""+order_url+"\">\n")
		                .append("		<img src=\""+preview_url+"\" alt=\""+content_name+"\" title=\""+content_name+"\" width=\"50\" height=\"50\" style=\"cursor:pointer\">\n")
		                .append("	</a></div>\n")
		                .append("	<div class=\"list\">\n")
		                .append("     <p class=\"p_tit\" style=\"cursor:pointer\">\n")
		                .append(content_name)
		                .append("		</p>\n")
		                .append("		<p class=\"p_detail\">\n")
		                .append("			<span class=\"t_dBlue\" style=\"float: left;\">Cena :</span> <span name=\"Gprice"+(i+1)+"\" id=\"Gprice"+(i+1)+"\" style=\"float: left;\">"+content_price+"</span> <span name=\"GGprice"+(i+1)+"\" id=\"GGprice"+(i+1)+"\" style=\"float: left;\">"+content_price2+"</span> PLN<br>\n")
		                .append("		</p>\n")
		                .append("		<p class=\"p_btnA\">\n")
		                .append("		<a href=\""+order_url+"\">\n")
		                .append("			<img src=\"/image/common/btn_buy.gif\" style=\"cursor:pointer\" alt=\"Kup\" style=\"cursor:pointer\">\n")
		                .append("		</a></p>\n")
		                .append("	</div>\n")
		                .append("</div>\n");
	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/rightgame_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    
    
    public void getRealToneHomeMain(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /*RINGTONE*/
            sHtml.setLength(0);

            if(pVector.size() > 0) {
            	for(int i=0; i<5; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");	                

	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                
	                sHtml.append("<li>\n")		
	                .append(content_name)
	                .append("<div class=\"p_btnA\">\n")
	                .append("	<img id=\"btnMusic"+(i+1)+"\" src=\""+ROOT_URL+"/image/common/btn_sound_off.gif\" onClick=\"musicPlay('"+(i+1)+"', '"+preview_url+"');\" alt=\"odtwarzanie muzyki\" style=\"cursor:pointer\">\n")
	                .append("	<a href=\""+order_url+"\"><img src=\""+ROOT_URL+"/image/common/btn_buy.gif\" alt=\""+content_name+"\"></a>\n")
	                .append("</div>\n")
	                .append("</li>\n");	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/homeringtone_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    

    
    public void getRealToneRight(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;
        
        try{
            /*RINGTONE*/
            sHtml.setLength(0);
            
            if(pVector.size() > 0) {
            	for(int i=0; i<5; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");
	                
	                if(content_name.length() >= 20){
	                	content_name = content_name.substring(0, 20) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");
	                
	                sHtml.append("<li>\n")
		                .append("  <span class=\"t_no\"></span>\n")
		                .append("				"+(i+1)+". "+content_name+"\n")
		                .append("	<span class=\"ico\">\n")
		                .append("		<img src=\"/image/common/btn_sound_off.gif\" onClick=\"musicRightPlay('"+(i+1)+"', '"+preview_url+"');\" style=\"cursor:pointer\">\n")
		                .append("		<a href=\""+order_url+"\"><img src=\"/image/common/btn_buy.gif\" alt=\"Kup\"></a>\n")
		                .append("	</span>\n")
		                .append("</li>\n");	                
	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/rightrealtone_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    

    public void getRealToneMember(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /*RINGTONE*/
            sHtml.setLength(0);
            
            if(pVector.size() > 0) {
            	for(int i=0; i<5; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");
	                
	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");

	                sHtml.append("<li>\n")
		                .append("	<span class=\"t_no\">"+(i+1)+". </span> "+content_name+"\n")
		                .append("	<div class=\"ico\" style=\"width:250;height:200; overflow-x:hidden;overflow-y:hidden;\">\n")
		                .append("		<img src=\"/image/common/btn_sound_off.gif\" onClick=\"musicPlay('"+(i+1)+"', '"+preview_url+"');\" style=\"cursor:pointer\">\n")
		                .append("		<a href=\""+order_url+"\"><img src=\"/image/common/btn_buy.gif\" alt=\"Scarica\"></a>\n")
		                .append("	</div>\n")
		                .append("</li>\n");	                

	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/memberrealtone_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    
    
    public void getWallpaper(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /*RINGTONE*/
            sHtml.setLength(0);
            
            if(pVector.size() > 0) {
            	for(int i=0; i<2; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");
	                
	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");
	                
	                
	                sHtml.append("<li class=\"leftA\">\n")
		                .append("	<div class=\"imgBox77\"><a href=\""+order_url+"\" style=\"cursor:pointer\">\n")
		                .append("	<img src=\""+preview_url+"\" alt=\""+content_name+"\" title=\""+content_name+"\" width=\"77\" height=\"77\">\n")
		                .append("</a></div>\n")
		                .append("	<p class=\"p_tit\">"+content_name+"</p>\n")
		                .append("</li>\n");
	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/homewallpaper_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }    

    public void getWallpaperMember(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /*RINGTONE*/
            sHtml.setLength(0);
            
            if(pVector.size() > 0) {
            	for(int i=0; i<1; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");
	                
	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");
	                
	                
	                sHtml.append("<div class=\"imgBox77\">\n")
		                .append("	<img src=\""+preview_url+"\" alt=\""+content_name+"\" title=\""+content_name+"\" width=\"77\" height=\"77\">\n")
		                .append("</div>\n")
		                .append("<div class=\"list\">\n")
		                .append("	<p class=\"p_tit\">"+content_name+"</p>\n")
		                .append("	<p class=\"p_detail\">\n")
		                .append("		<a href=\""+order_url+"\"><img src=\"/image/common/btn_detail.gif\" alt=\"DetailSzczegoły\"></a>\n")
		                .append("		<a href=\""+order_url+"\"><img src=\"/image/common/btn_buy.gif\" alt=\"Kup\"></a>\n")
		                .append("	</p>\n")
		                .append("</div>\n");
	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/memberwallpaper_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }     
    

    public void getScreensaverRight(Vector pVector, Vector vMore) throws Exception  {
        OutputStreamWriter fw = null;

        try{
            /*RINGTONE*/
            sHtml.setLength(0);
            
            if(pVector.size() > 0) {
            	for(int i=0; i<2; i++){
	                Properties pContentList = (Properties) pVector.elementAt(i);
	                more_link  = StringUtils.defaultString(pContentList.getProperty("more_link"),"");
	                content_id = StringUtils.defaultString(pContentList.getProperty("CONTENT_ID"),"");
	                content_name = StringUtils.defaultString(pContentList.getProperty("CONTENT_NAME"),"");
	                preview_url = StringUtils.defaultString(pContentList.getProperty("PREVIEW_URL"),"");
	                order_url = StringUtils.defaultString(pContentList.getProperty("ORDER_URL"),"");
	                content_price = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE"),"");            
	                content_price2 = StringUtils.defaultString(pContentList.getProperty("CONTNT_PRICE2"),"");
	                
	                if(content_name.length() >= 24){
	                	content_name = content_name.substring(0, 24) + "..";
	                }	                
	                order_url = StringUtils.replace(order_url, "&", "&amp;");
	                preview_url = StringUtils.replace(preview_url, "&", "&amp;");
	                

	                sHtml.append("<div class=\"prdInfo mb5\">\n")
		                .append("	<div class=\"imgBox50\">\n")
		                .append("	<a href=\""+order_url+"\">\n")
		                .append("		<img src=\""+preview_url+"\" alt=\""+content_name+"\" title=\""+content_name+"\" width=50 height=50 style=\"cursor:pointer\">\n")
		                .append("	</a></div>\n")
		                .append("	<div class=\"list\">\n")
		                .append("		<p class=\"p_tit\" style=\"cursor:pointer\">\n")
		                .append(content_name)
		                .append("		</p>\n")
		                .append("		<p class=\"p_detail\">\n")
		                .append("			<span class=\"t_dBlue\" style=\"float: left;\">Cena :</span> <span name=\"Tprice"+(i+1)+"\" id=\"Tprice"+(i+1)+"\" style=\"float: left;\">"+content_price+"</span> <span name=\"TTprice"+(i+1)+"\" id=\"TTprice"+(i+1)+"\" style=\"float: left;\">"+content_price2+"</span> PLN<br>\n")
		                .append("		</p>\n")
		                .append("		<p class=\"p_btnA\">\n")
		                .append("		<a href=\""+order_url+"\">\n")
		                .append("			<img src=\"/image/common/btn_buy.gif\" style=\"cursor:pointer\" alt=\"Kup\" style=\"cursor:pointer\">\n")
		                .append("		</a></p>\n")
		                .append("	</div>\n")
		                .append("</div>\n");
	                
            	}
            }
            
            fw = new OutputStreamWriter(new FileOutputStream(FILE_PATH + "/rightscreensaver_include.html",false), "utf-8");
            fw.write(sHtml.toString());
            fw.close();

        }finally{
            if (fw != null) try { fw.close(); } catch (Exception e) {}
        }
    }     
    
    public static void main( String[] args ){
      Logger.getLogger("home.pol_home").info("( * ) Start.");
      makeCpHtmlPol mvm = new makeCpHtmlPol();
      Logger.getLogger("home.pol_home").info("( * ) End.");
    }
}